/*
 * @Descripttion: 重构Window方法
 * @Version: 1.0
 * @Author: undead
 * @Date: 2021-03-25 21:06:31
 * @LastEditors: undead
 * @LastEditTime: 2021-12-02 16:27:45
 */

import logger from "./logger";

const { onerror } = window;

export default class zWindow {
    constructor() {
        const proptoTypes = Object.getPrototypeOf(this);
        for (let key in proptoTypes) {
            if (typeof proptoTypes[key] === "function") {
                window[key] = proptoTypes[key];
            }
        }
    }
    /**
     * 
     * @param errorMessage 错误信息
     * @param scriptURI 出错文件
     * @param lineNumber 出错行号
     * @param columnNumber 出错列号
     * @param errorObj 错误详情
     */
    onerror(errorMessage: string, scriptURI: string, lineNumber: number, columnNumber: number, errorObj: ReferenceError) {
        logger.addWindow(errorMessage, scriptURI, lineNumber, columnNumber,errorObj.stack);
    }
}
